/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/

import { getAbilityVersionList, abilityImport, getAbilityPublishDetail, getModelList } from '@/services/ability';
import { Reducer } from 'redux';
import { resCarMapList, carModelIntegrate } from '@/utils/toolChainUtilscopy';

export interface BaseModelState {
    data: any;
    publishDetail: any;
}
export interface BaseModelType {
    namespace: string;
    state: BaseModelState;
    effects: any;
    reducers: {
        save: Reducer<BaseModelState>;
        savePubLishDetail: Reducer<BaseModelState>;
    };
}
const abilityModel: BaseModelType = {
    namespace: "abilityModel",
    state: {
        data: {},
        publishDetail: {},
    },
    effects: {
        // 获取soc列表
        // eslint-disable-next-line
        *getSocListForVersion({ }, { call, put }) {
            const response = yield call(getAbilityVersionList);
            if (response.statusCode === "0") {
                yield put({
                    type: 'save',
                    payload: {
                        data: response.data
                    },
                });
            }
            return response;
        },
        *getAbilityPublishDetail({ payload }, { call, put }) {
            const allCarModelListRes = yield call(getModelList);
            // const allCarModelListRes = {
            //     data: [
            //         {
            //             id: 61,
            //             seriesCode: '1234',
            //             seriesName: '车系1234',
            //             modelCode: 'model1234',
            //             modelName: '车型1234',
            //             syncTime: '2023-02-14T07:30:02.084Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.32Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-14T07:30:02.084Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 60,
            //             seriesCode: '1233',
            //             seriesName: '车系1233',
            //             modelCode: 'model1233',
            //             modelName: '车型1233',
            //             syncTime: '2023-02-09T07:00:06.256Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.281Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-09T07:00:06.256Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 59,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XEVALTSHJGAA1',
            //             modelName: '增程两驱1',
            //             syncTime: '2023-02-17T06:30:02.168Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.252Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.168Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 58,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XEVALTSHJGAA2',
            //             modelName: '增程两驱2',
            //             syncTime: '2023-02-17T06:30:02.143Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.221Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.143Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 57,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XEVALTSHJGAA3',
            //             modelName: '增程两驱3',
            //             syncTime: '2023-02-17T06:30:02.117Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.189Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.117Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 56,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XRVALFSHECAAB',
            //             modelName: '新增003纯点首发',
            //             syncTime: '2023-02-17T06:30:02.093Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.159Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.093Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 55,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XRVALMSHECAAB',
            //             modelName: '003N2前装',
            //             syncTime: '2023-02-17T06:30:02.067Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.127Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.067Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 54,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XRVALMSHECAAA',
            //             modelName: '003N2后装',
            //             syncTime: '2023-02-17T06:30:02.042Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.092Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.042Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 53,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'XRVALTSHECACA',
            //             modelName: '003N3',
            //             syncTime: '2023-02-17T06:30:02.018Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.054Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:02.018Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 52,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SPVALTSHECAAB',
            //             modelName: '003混动N3四驱',
            //             syncTime: '2023-02-17T06:30:01.995Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:29.021Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.995Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 51,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SPVALMSHECAAB',
            //             modelName: '003混动N2四驱',
            //             syncTime: '2023-02-17T06:30:01.96Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.992Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.96Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 50,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SPVALFSHECAAB',
            //             modelName: '003混动N1四驱',
            //             syncTime: '2023-02-17T06:30:01.938Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.96Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.938Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 49,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SEVALTSHECAAB',
            //             modelName: '003电动N3四驱',
            //             syncTime: '2023-02-17T06:30:01.846Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.925Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.846Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 48,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SEVALMSHECAAB',
            //             modelName: '003电动N2四驱',
            //             syncTime: '2023-02-17T06:30:01.824Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.897Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.824Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 47,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SEVRLFSHECAAB',
            //             modelName: '003电动N1后驱',
            //             syncTime: '2023-02-17T06:30:01.801Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.865Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.801Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 46,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SEVALTSHECADB',
            //             modelName: '003纯电N3四驱长续航版',
            //             syncTime: '2023-02-17T06:30:01.769Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.834Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.769Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 45,
            //             seriesCode: '003',
            //             seriesName: 'dftc-003',
            //             modelCode: 'SEVALMSHECADB',
            //             modelName: '003纯电N2四驱长续航版',
            //             syncTime: '2023-02-17T06:30:01.724Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.804Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.724Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 44,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALTSHEFAAB',
            //             modelName: '002 86纯电N3',
            //             syncTime: '2023-02-17T06:30:01.679Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.773Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.679Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 43,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MPVALFSHEFAAB',
            //             modelName: '002 混动N1',
            //             syncTime: '2023-02-17T06:30:01.649Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.74Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.649Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 42,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MPVALTSHEFAAB',
            //             modelName: '002 混动N3',
            //             syncTime: '2023-02-17T06:30:01.627Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.707Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.627Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 41,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALMSHEFAAB',
            //             modelName: '002 86纯电N2',
            //             syncTime: '2023-02-17T06:30:01.604Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.677Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.604Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 40,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MPVALMSHEFAAB',
            //             modelName: '002 混动N2',
            //             syncTime: '2023-02-17T06:30:01.58Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.637Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.58Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 39,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALFSHEFAAB',
            //             modelName: '002 86纯电N1',
            //             syncTime: '2023-02-17T06:30:01.548Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.596Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.548Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 38,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALTSHEFADB',
            //             modelName: '002 112纯电N3',
            //             syncTime: '2023-02-17T06:30:01.525Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.562Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.525Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 37,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALMSHEFADB',
            //             modelName: '002 纯电N2长续航版',
            //             syncTime: '2023-02-17T06:30:01.502Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.532Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.502Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 36,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALFSHEFADB',
            //             modelName: '002 112纯电N1',
            //             syncTime: '2023-02-17T06:30:01.478Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.501Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.478Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 35,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MEVALTSHEFAFB',
            //             modelName: '002 纯电长续航改装版',
            //             syncTime: '2023-02-17T06:30:01.455Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.47Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.455Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 34,
            //             seriesCode: '002',
            //             seriesName: '002',
            //             modelCode: 'MPVALTSHEFAFB',
            //             modelName: '002 混动改装版',
            //             syncTime: '2023-02-17T06:30:01.429Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.437Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.429Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 33,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALMSHJGACA',
            //             modelName: '001 增程N2四驱纪念版',
            //             syncTime: '2023-02-17T06:30:01.404Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.406Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.404Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 32,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALMSHJGAAA',
            //             modelName: '001 增程N2四驱',
            //             syncTime: '2023-02-17T06:30:01.385Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.376Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.385Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 31,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALMSHJGAEA',
            //             modelName: '001增程N2四驱蜂巢电池版',
            //             syncTime: '2023-02-17T06:30:01.361Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.349Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.361Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 30,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALTSHJGAAA',
            //             modelName: '001 增程N3四驱',
            //             syncTime: '2023-02-17T06:30:01.329Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.319Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.329Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 29,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVRLFSHJGAAA',
            //             modelName: '001 纯电N1两驱',
            //             syncTime: '2023-02-17T06:30:01.299Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.291Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.299Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 28,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALTSHJGACA',
            //             modelName: '001 纯电N3四驱纪念版',
            //             syncTime: '2023-02-17T06:30:01.277Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.265Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.277Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 27,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALMSHJGADB',
            //             modelName: '001增程N2四驱长续航版',
            //             syncTime: '2023-02-17T06:30:01.256Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.238Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.256Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 26,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALMSHJGADB',
            //             modelName: '001纯电N2四驱长续航版',
            //             syncTime: '2023-02-17T06:30:01.232Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.208Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.232Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 25,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVRLMSHJGAAB',
            //             modelName: '111111121',
            //             syncTime: '2023-02-17T06:30:01.207Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.157Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.207Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 24,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALFSHJGAAB',
            //             modelName: '001纯电N1四驱标准续航版',
            //             syncTime: '2023-02-17T06:30:01.186Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.133Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.186Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 23,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALMSHJGAAA',
            //             modelName: '001 纯电N2四驱',
            //             syncTime: '2023-02-17T06:30:01.165Z',
            //             status: 1,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.105Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.165Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 22,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALTSHJGAAB',
            //             modelName: '001增程N3四驱标准续航版',
            //             syncTime: '2023-02-17T06:30:01.14Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.069Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.14Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 21,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVRLFSHJGAAB',
            //             modelName: '001纯电N1两驱标准续航版',
            //             syncTime: '2023-02-17T06:30:01.116Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.035Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.116Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 20,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVRLFSHJGAAB',
            //             modelName: '001增程N1两驱标准续航版',
            //             syncTime: '2023-02-17T06:30:01.09Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:28.006Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.09Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 19,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALMSHJGACA',
            //             modelName: '001 纯电N2四驱纪念版',
            //             syncTime: '2023-02-17T06:30:01.065Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.979Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.065Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 18,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALFSHJGAAA',
            //             modelName: '增程N1四驱（无用）',
            //             syncTime: '2023-02-17T06:30:01.039Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.954Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.04Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 17,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALFSHJGAAA',
            //             modelName: '001 纯电N1四驱',
            //             syncTime: '2023-02-17T06:30:01.014Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.928Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:01.014Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 16,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALFSHJGAAB',
            //             modelName: '001增程N1四驱标准续航版',
            //             syncTime: '2023-02-17T06:30:00.987Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.899Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.987Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 15,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALTSHJGAAB',
            //             modelName: '001纯电N3四驱标准续航版',
            //             syncTime: '2023-02-17T06:30:00.96Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.86Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.96Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 14,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVRLMSHJGAAA',
            //             modelName: '001 纯电N2两驱',
            //             syncTime: '2023-02-17T06:30:00.938Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.833Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.938Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 13,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVRLMSHJGAAB',
            //             modelName: '测试',
            //             syncTime: '2023-02-17T06:30:00.915Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.803Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.915Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 12,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVRLMSHJGAAA',
            //             modelName: '001 增程N2两驱',
            //             syncTime: '2023-02-17T06:30:00.889Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.779Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.889Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 11,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALTSHJGADB',
            //             modelName: '001增程N3四驱长续航版',
            //             syncTime: '2023-02-17T06:30:00.829Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.739Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.829Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 10,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALFSHJGAEA',
            //             modelName: '001增程N1四驱蜂巢电池版',
            //             syncTime: '2023-02-17T06:30:00.805Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.714Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.805Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 9,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVRLFSHJGAEA',
            //             modelName: '001增程N1两驱蜂巢电池版',
            //             syncTime: '2023-02-17T06:30:00.782Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.686Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.782Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 8,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVRLMSHJGACA',
            //             modelName: '001 纯电N2两驱纪念版',
            //             syncTime: '2023-02-17T06:30:00.76Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.659Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.76Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 7,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALTSHJGACA',
            //             modelName: '001 增程N3四驱纪念版',
            //             syncTime: '2023-02-17T06:30:00.739Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.633Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.739Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 6,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVRLFSHJGAAA',
            //             modelName: '001 增程N1两驱',
            //             syncTime: '2023-02-17T06:30:00.71Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.609Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.711Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 5,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALTSHJGAAA',
            //             modelName: '001 纯电N3四驱',
            //             syncTime: '2023-02-17T06:30:00.688Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.58Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.688Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 4,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVFRTSHJGAAB',
            //             modelName: '1',
            //             syncTime: '2023-02-17T06:30:00.665Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.549Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.665Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 3,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALMSHJGBDB',
            //             modelName: '001纯电N2四驱长续航版 出口欧洲',
            //             syncTime: '2023-02-17T06:30:00.643Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.522Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.643Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 2,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XEVALTSHJGADB',
            //             modelName: '001纯电N3四驱长续航版',
            //             syncTime: '2023-02-17T06:30:00.621Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.409Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.621Z',
            //             deleted: 0,
            //         },
            //         {
            //             id: 1,
            //             seriesCode: '001',
            //             seriesName: '001',
            //             modelCode: 'XRVALMSHJGAAB',
            //             modelName: '001增程N2四驱标准续航版',
            //             syncTime: '2023-02-17T06:30:00.598Z',
            //             status: 0,
            //             createUser: 0,
            //             createTime: '2022-09-20T01:29:27.353Z',
            //             updateUser: 0,
            //             updateTime: '2023-02-17T06:30:00.599Z',
            //             deleted: 0,
            //         },
            //     ],
            // };
            // 构建所有车系车型
            const { carModelTree, allCarModelMap } = carModelIntegrate(allCarModelListRes?.data);
            const allCarModelList = carModelTree;
            // 获取已发布/未发布的车型soc信息
            const publishedCarRes = yield call(getAbilityPublishDetail, payload);
            const result = resCarMapList(payload, allCarModelList, allCarModelMap, publishedCarRes);
            yield put({
                type: 'savePubLishDetail',
                payload: {
                    publishDetail: result
                },
            });
            return result;
        },
        *getabilityImport({ payload }, { call }) {
            const res = yield call(abilityImport, payload);
            return res;
        },
    },

    reducers: {
        save(state, action) {
            return {
                ...state,
                ...action.payload,
            };
        },
        savePubLishDetail(state, action) {
            return {
                ...state,
                ...action.payload,
            };
        }
    },
};
export default abilityModel;
